package gdma.hqdes.dao;

import gdma.hqdes.bean.UnitMember;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UnitMemberMapper {

    @Select("select u.unit_id from user u where u.id=#{userId}")
    Long selectUnitIdByUserId(long userId);

    UnitMember selectById(long userId);

    List<UnitMember> selectByUnitId(long unitId);

    @Delete("delete from user__role where user_id=#{userId}")
    int deleteUserRole(long userId);

    @Delete("delete from account where user_id=#{userId}")
    int deleteAccount(long userId);

    @Delete("delete from user where id=#{userId}")
    int deleteUser(long userId);

}
